Skip to content

Conversation

kryptocodes
Copy link
Contributor

@kryptocodes kryptocodes commented Aug 9, 2025

Description

Fixed Android instant app redirect to use proper intent scheme for redirection. The previous implementation used a direct URL to the web verification page, but this change wraps it in an Android intent that will redirect users to instant app (also remove the open in browser app)

Testing (ignore for documentation update)

image

Type of change

  • Bug fix
  • [] New feature
  • [] Breaking change
  • [] Documentation update

Checklist:

Additional Notes:

If the device doesn't support instant app it will redirect to the playstore

Summary by CodeRabbit

  • Bug Fixes
    • Improved Android instant-app redirection by switching to an intent-based URL format, resulting in more reliable navigation to the app page from within the app flow.

Copy link

coderabbitai bot commented Aug 9, 2025

Walkthrough

The redirectToInstantApp method in ReclaimProofRequest (src/Reclaim.ts) now builds an Android intent URI (intent://...#Intent;...) containing the template parameter instead of using the previous HTTPS verification URL. Encoding, error handling, and public APIs remain unchanged.

Changes

Cohort / File(s) Change Summary
Instant App redirect
src/Reclaim.ts
Replaced construction of an HTTPS verification URL with an Android intent URI (intent://...#Intent;...) in redirectToInstantApp; retained template encoding and logging. No public signatures changed.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ReclaimProofRequest
    participant AndroidLauncher

    User->>ReclaimProofRequest: call redirectToInstantApp()
    ReclaimProofRequest->>ReclaimProofRequest: encode template
    ReclaimProofRequest->>ReclaimProofRequest: build intent URI with template
    ReclaimProofRequest->>User: return/trigger intent URI
    User->>AndroidLauncher: Android receives intent URI and launches app
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

  • Fix: Shorten Url for Desktop Device #41 — Also modifies URL-generation logic in src/Reclaim.ts within ReclaimProofRequest, switching URL templates and adding device-type checks; likely related to intent/URL handling.

Poem

A rabbit hops with coded cheer,
Wrapping links for apps to steer.
Intent strings now hold the key,
Launching fast for Android to be.
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.38.6)
src/Reclaim.ts

[
{
"text": "window.postMessage(message, '')",
"range": {
"byteOffset": {
"start": 28201,
"end": 28233
},
"start": {
"line": 697,
"column": 16
},
"end": {
"line": 697,
"column": 48
}
},
"file": "src/Reclaim.ts",
"lines": " window.postMessage(message, '
');",
"charCount": {
"leading": 16,
"trailing": 1
},
"language": "TypeScript",
"ruleId": "message-origin-validation",
"severity": "warning",
"note": "[CWE-923] Improper Restriction of Communication Channel to Intended Endpoints [REFERENCES]\n - https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\n - https://cwe.mitre.org/data/definitions/923.html",
"message": "Detected usage of wildcard '' as origin in postMessage. Always specify an exact target origin instead of using '' to prevent sensitive data from being sent to malicious websites and avoid spoofing attacks.",
"labels": [
{
"text": "window.po

... [truncated 12152 characters] ...

},
"style": "secondary"
},
{
"text": "''",
"range": {
"byteOffset": {
"start": 28723,
"end": 28726
},
"start": {
"line": 712,
"column": 36
},
"end": {
"line": 712,
"column": 39
}
},
"style": "secondary"
},
{
"text": "(message, '
')",
"range": {
"byteOffset": {
"start": 28713,
"end": 28727
},
"start": {
"line": 712,
"column": 26
},
"end": {
"line": 712,
"column": 40
}
},
"style": "secondary"
}
]
}
]
Error: 2 error(s) found in code.
Help: Scan succeeded and found error level diagnostics in the codebase.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 15b5d12 and 4cec6ff.

📒 Files selected for processing (1)
  • src/Reclaim.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Reclaim.ts
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/instant-app-redirect

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kryptocodes kryptocodes changed the title Fix: Update URL construction for Android instant app redirection [WIP]: Update URL construction for Android instant app redirection Aug 9, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
src/Reclaim.ts (1)

735-739: Avoid logging full redirect URL (PII leakage risk)

instantAppUrl embeds JSON template (context, parameters, etc.). Logging it can leak PII. Log minimal context instead.

-            logger.info('Redirecting to Android instant app: ' + instantAppUrl);
+            logger.info(`Redirecting to Android instant app (sessionId=${this.sessionId})`);
🧹 Nitpick comments (1)
src/Reclaim.ts (1)

737-739: Optional: use replace() to avoid back-navigation and consider canonical intent fallback

  • Using window.location.replace prevents users from landing back on the intermediate page via back button.
  • For broader compatibility, consider an intent URI that uses S.browser_fallback_url (encoded) instead of query params to Play. This is a common, well-supported pattern.
-            window.location.href = instantAppUrl;
+            window.location.replace(instantAppUrl);

Example alternative intent format (for future refactor):

  • intent://<host><path>?<q>#Intent;scheme=https;S.browser_fallback_url=<encoded_play_store_url>;end;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7832579 and 14dd33c.

📒 Files selected for processing (1)
  • src/Reclaim.ts (1 hunks)

@kryptocodes kryptocodes changed the title [WIP]: Update URL construction for Android instant app redirection fix: Update URL construction for Android instant app redirection Aug 9, 2025
src/Reclaim.ts Outdated
@@ -730,8 +730,7 @@ export class ReclaimProofRequest {
let template = encodeURIComponent(JSON.stringify(this.templateData));
template = replaceAll(template, '(', '%28');
template = replaceAll(template, ')', '%29');

const instantAppUrl = `https://share.reclaimprotocol.org/verify/?template=${template}`;
const instantAppUrl = `intent://details?id=org.reclaimprotocol.app&launch=true&template=${template}&referrer=Z#Intent;scheme=market;action=android.intent.action.VIEW;package=com.android.vending;end;`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

referer as Z why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants